package server

type DownloadServerImpl struct{}

func (d *DownloadServerImpl) Download(req *DownloadReq, server Download_DownloadServer) error {
	offset := req.Offset
	//循环发送数据
	for {
		err := server.Send(&DownloadRes{
			Offset: offset,
			Size:   4 * 1024,
			Data:   nil,
		})
		if err != nil {
			return err
		}
		offset += 4 * 1024
		if offset >= req.Offset+req.Size {
			break
		}
	}
	return nil
}
